The present invention relates to a method and an apparatus for transferring data between different memories and, more particularly, to real-time blank page detection of data read from a memory.
FIG. 1 shows a conventional device 100 for transferring data between a flash memory 102 and an external memory 104. The flash memory 102 can be any type of memory that contains information (data) stored in units of programmed pages, and the external memory 104 can be either on or off-chip random access memory (RAM). The device 100 is used to transfer data between low cost, page-based flash memory 102 and high cost, RAM (the external memory 104). Due to the high possibility of errors either programming or reading from the flash memory 102, the device 100, in general, implements enhanced algorithms to recover from these errors. When being programmed from the external memory 104 to the flash memory 102 by the device 100, the data sequentially passes an interface 106 of the device 100, a data processing unit 108 that encodes the data with a set of codes, a randomizer/de-randomizer 110 that randomizes the data to combat noise, and a buffer 112 that buffers a portion of the encoded, randomized data before being programmed into the flash memory 102 with a memory controller 114. A programmed page stored in the flash memory 102 usually contains equivalently distributed “0” and “1” bits due to the randomization. The buffer, which is implemented by registers, usually has a small memory size such as several 32-bit words to save area. The flash memory 102 stores the data page-by-page. Thus, when reading a page of data from the flash memory 102 with the device 100, the page of data also sequentially passes the memory controller 114 for reading the page of data from the flash memory 102, the buffer 112 for buffering a portion of the page of data, the randomizer/de-randomizer 110 for de-randomizing the page of data, and the data processing unit 108 for decoding the de-randomized page of data that has already flowed out of the device 100 and storing in the external memory 104 while actual error locations are calculated some time later due to the complexity of the calculations. The set of codes used for encoding and decoding are error-correcting codes (ECC), such as BCH codes. Therefore, the decoded data stored in the external memory 104 will reflow to the data processing unit 108 for error correcting.
In addition to a plurality of programmed pages with programmed data, the flash memory 102 may include some blank pages that contain only “0xFF” bytes, and some bad pages that cannot be programmed properly. Some of the bad pages have been previously detected and marked during manufacturing, while some of the bad pages are transformed from good pages over time due to progressive deterioration. As the randomization and de-randomization are performed by XORing the data with a random sequence generated by the randomizer/de-randomizer 110, a de-randomized blank page will contain non-0xFF bytes, therefore, when a portion of the page of data fails in the error correcting process after being de-randomized, the page of data must be re-read from the flash memory 102, and transferred to the data processing unit 108 skipping de-randomization for whole-page blank page detection. The data processing unit 108 detects whether the page of data is a blank page by scanning the whole page.
However, rereading the page of data from the flash memory 102 for blank page detection is time consuming, and when a blank page is found, the external memory 104 already contains at least a part of the data of the blank page that has been previously de-randomized and decoded. Thus filling the external memory 104 with 0xFF bytes to clear the part of data of the de-randomized and decoded blank page also takes time. It is therefore desirable to find a method for real-time blank page detection to reduce the data transmission time.